/*
 * @Author: wangwenshuai 644586996@qq.com
 * @Date: 2022-11-17 12:05:57
 * @LastEditors: wangwenshuai 644586996@qq.com
 * @LastEditTime: 2022-11-17 12:10:29
 * @FilePath: \carbon-pccounting-project\src\utils\device.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import enquireJs from 'enquire.js'
export const DEVICE_TYPE = {
    DESKTOP: 'desktop',
    TABLET: 'tablet',
    MOBILE: 'mobile'
}
const enquireScreen = function (callback) {
    const matchDesktop = {
        match: () => {
            callback && callback(DEVICE_TYPE.DESKTOP)
        }
    }
    const matchLablet = {
        match: () => {
            callback && callback(DEVICE_TYPE.TABLET)
        }
    }
    const matchMobile = {
        match: () => {
            callback && callback(DEVICE_TYPE.MOBILE)
        }
    }

    // enquireJs.register('screen and (max-width: 1087.99px)', handler)
    // enquireJs.register('screen and (max-width: 767.99px)', handler2)
    enquireJs.register('screen and (max-width: 767px)', matchMobile).
        register('screen and (min-width: 768px) and (max-width: 992px)', matchLablet).
        register('screen and (min-width: 992px)', matchDesktop)

}

export default enquireScreen